<?php


class nlWidgetFormNumberRange extends sfWidgetForm {


  public function configure($options = array(), $attributes = array()) {

    $this->addOption('from', new sfWidgetFormInputText());
    $this->addOption('to', new sfWidgetFormInputText());

    $this->addOption('template', 'от %from% до %to%');

  }


  public function render($name, $value = null, $attributes = array(), $errors = array()) {
    $values = array_merge(array('from' => '', 'to' => ''), is_array($value) ? $value : array());

    return strtr($this->translate($this->getOption('template')), array(
      '%from%' => $this->getOption('from')->render($name . '[from]', $value['from']),
      '%to%' => $this->getOption('to')->render($name . '[to]', $value['to']),
    ));

  }

  /**
   * Gets the stylesheet paths associated with the widget.
   *
   * @return array An array of stylesheet paths
   */
//  public function getStylesheets() {
//    return array_unique(array_merge($this->getOption('from_date')->getStylesheets(), $this->getOption('to_date')->getStylesheets()));
//  }

  /**
   * Gets the JavaScript paths associated with the widget.
   *
   * @return array An array of JavaScript paths
   */
//  public function getJavaScripts() {
//    return array_unique(array_merge($this->getOption('from_date')->getJavaScripts(), $this->getOption('to_date')->getJavaScripts()));
//  }
}

